home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / upsd / ups_folder / upsd.sh.script < prev    next >
Encoding:
Text File  |  1991-05-01  |  16.7 KB  |  672 lines

  1. #! /bin/sh
  2. # This is a shell archive.  Remove anything before this line, then unpack
  3. # it by saving it into a file and typing "sh file".  To overwrite existing
  4. # files, type "sh file -c".  You can also feed this as standard input via
  5. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  6. # will see the following message at the end:
  7. #        "End of archive 1 (of 1)."
  8. # Contents:  MANIFEST Makefile README common.h funcs.c main.c ups
  9. # Wrapped by root@pilikia on Sat Apr  6 21:22:27 1991
  10. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  11. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  12.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  13. else
  14. echo shar: Extracting \"'MANIFEST'\" \(422 characters\)
  15. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  16. X   File Name        Archive #    Description
  17. X-----------------------------------------------------------
  18. X MANIFEST                   1    This shipping list
  19. X Makefile                   1    Upsd makefile    
  20. X README                     1    Documentation
  21. X common.h                   1    Common program header
  22. X funcs.c                    1    Functions 
  23. X main.c                     1    Main program
  24. X ups                        1    Init.d startup script
  25. END_OF_FILE
  26. if test 422 -ne `wc -c <'MANIFEST'`; then
  27.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  28. fi
  29. # end of 'MANIFEST'
  30. fi
  31. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'Makefile'\"
  33. else
  34. echo shar: Extracting \"'Makefile'\" \(942 characters\)
  35. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  36. X##
  37. X#    M a k e f i l e
  38. X#
  39. X#    makefile for UPS monitor daemon
  40. X#
  41. X#    Arthur W. Neilson III
  42. X#    art@pilikia.pegasus.com
  43. X#    Sat Mar 30 1991
  44. X#
  45. X
  46. XCC = cc
  47. XDEFS =
  48. XCFLAGS = -O $(DEFS)
  49. XCFILES = main.c funcs.c
  50. XOFILES = main.o funcs.o
  51. XHFILES = common.h
  52. XLIBES =
  53. XDESTDIR = /etc
  54. XINITDIR = /etc/init.d
  55. XRC2DIR = /etc/rc2.d
  56. XRC2NUM = 22
  57. X
  58. Xupsd: $(OFILES)
  59. X    $(CC) $(CFLAGS) $(OFILES) -o $@ $(LIBES)
  60. X    @strip $@
  61. X    @mcs -d $@
  62. X
  63. Xinstall: upsd
  64. X    cp upsd $(DESTDIR)/upsd
  65. X    chown root $(DESTDIR)/upsd
  66. X    chgrp sys $(DESTDIR)/upsd
  67. X    chmod 550 $(DESTDIR)/upsd
  68. X
  69. Xinstall_rc: install
  70. X    cp ups $(INITDIR)/ups
  71. X    chown root $(INITDIR)/ups
  72. X    chgrp sys $(INITDIR)/ups
  73. X    chmod 744 $(INITDIR)/ups
  74. X    ln $(INITDIR)/ups $(RC2DIR)/S$(RC2NUM)ups
  75. X
  76. Xindent:
  77. X    @for f in $(CFILES); do \
  78. X        indent $$f; \
  79. X    done
  80. X
  81. Xkit:
  82. X    makekit -m
  83. X
  84. Xclean:
  85. X    rm -f upsd core *.o *.BAK Part*
  86. X
  87. Xclobber: clean
  88. X    rm -f $(DESTDIR)/upsd $(INITDIR)/ups $(RC2DIR)/S$(RC2NUM)ups
  89. X
  90. X# dependencies
  91. Xmain.o:        main.c $(HFILES)
  92. Xfuncs.o:    funcs.c $(HFILES)
  93. END_OF_FILE
  94. if test 942 -ne `wc -c <'Makefile'`; then
  95.     echo shar: \"'Makefile'\" unpacked with wrong size!
  96. fi
  97. # end of 'Makefile'
  98. fi
  99. if test -f 'README' -a "${1}" != "-c" ; then 
  100.   echo shar: Will not clobber existing file \"'README'\"
  101. else
  102. echo shar: Extracting \"'README'\" \(3910 characters\)
  103. sed "s/^X//" >'README' <<'END_OF_FILE'
  104. X     Tue Apr 02 23:24:20 HST 1991    art@pilikia.pegasus.com        Pg. 1
  105. X
  106. X    INTRODUCTION
  107. X
  108. X    The UPS monitor daemon or "upsd"  watches the serial port
  109. X    connected to an UPS and will perform an unattended shutdown
  110. X    of the system if the UPS is on battery longer than a specified
  111. X    number of minutes.  Upsd needs to watch a tty with modem control
  112. X    properties, and expects the UPS to raise DCD when it switches
  113. X    to battery backup and drop DCD when it goes back to online.
  114. X    Upsd was developed and tested under ISC with the FAS 2.08 driver
  115. X    and an American Power Conversion SmartUPS 600, your milage may
  116. X    vary on other OSes and UPSes.
  117. X
  118. X    The C source was written for system V and hence will require 
  119. X    some work to get it working under BSD or other UNIXes, the
  120. X    program is built via the Makefile.  A number of configurable
  121. X    defaults are in common.h, you may want to hack that file before
  122. X    making upsd.  Although the program can be run manually from the
  123. X    command line, users will most likely want the program to start
  124. X    automatically from their /etc/rc script (SYS5R2) or a script
  125. X    in /etc/rc2.d (SYS5R3).  The Makefile by default installs upsd
  126. X    in the /etc directory when the install target is made.  
  127. X
  128. X
  129. X     Tue Apr 02 23:24:20 HST 1991    art@pilikia.pegasus.com        Pg. 2
  130. X
  131. X
  132. X    COMMAND LINE OPTIONS
  133. X
  134. X    Upsd runtime behavior can be configured either on the command
  135. X    line or via environment variables.  The command line options
  136. X    take precedence to the environment variable settings, and are
  137. X    as follows:
  138. X
  139. X    usage: upsd [-d tty][-c cmd][-l log][-t min]
  140. X        -d tty        pathname of UPS device
  141. X        -c cmd        pathname of shutdown command
  142. X        -l log        pathname of UPS log file
  143. X        -t min        delay time in minutes
  144. X
  145. X    The -d tty option must specify the full pathname (including the
  146. X    /dev/ prefix) to the tty device the UPS is on.
  147. X
  148. X    Example:
  149. X
  150. X    upsd -d /dev/ttyFM00
  151. X
  152. X    The -c cmd option specifies the full pathname of the command
  153. X    to be executed to shut down the system.  This command must
  154. X    be enclosed in quotes if it consists of 2 or more words.
  155. X
  156. X    Example:
  157. X
  158. X    upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0"
  159. X
  160. X    The -l option specified the logfile upsd will write it's event
  161. X    messages to, these messages give the date and time that the UPS
  162. X    daemon started, switched to battery, switched back to online,
  163. X    executed the shutdown command, or was terminated via SIGTERM.
  164. X
  165. X    Example:
  166. X
  167. X    upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0" -l /etc/upslog
  168. X
  169. X    Finally, the -t option specifies the number of minutes to allow
  170. X    the UPS to be on battery backup before executing the shutdown
  171. X    sequence.  This number must be between 1 and 30.  Be careful not
  172. X    to choose a value greater than the number of minutes of battery
  173. X    time your UPS supports with your current load.  A value in the
  174. X    5 to 10 minute range is probably sufficient.
  175. X
  176. X    Example:
  177. X
  178. X    upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0" -l /etc/upslog -t 10
  179. X    
  180. X     Tue Apr 02 23:24:20 HST 1991    art@pilikia.pegasus.com        Pg. 3
  181. X
  182. X
  183. X    ENVIRONMENT VARIABLES
  184. X
  185. X    The following environment variables can be set if that interface
  186. X    is preferred to the command line options.  Note again that command
  187. X    line options override the environment variable settings.
  188. X
  189. X
  190. X    Environment    Equivalent        Default
  191. X    Variable    Command line option    Value
  192. X    UPSPORT            -p        /dev/ttyFM00
  193. X    UPSSHUT            -c        "/etc/shutdown -y -g1 -i0"
  194. X    UPSLOG            -l        /etc/upslog
  195. X    UPSTIME            -t        10
  196. X
  197. X    Note that the compiled in default values can be altered in common.h
  198. X    and the program can be recompiled.  If no command line options or
  199. X    environment variables exist, the defaults will be used.  The table
  200. X    above gives the environment variables looked for by the program and
  201. X    their command line option counterparts.  All the rules applying to
  202. X    the command line options apply to the environment variables as well.
  203. X
  204. X    If you have any comments or suggestions regarding my program,
  205. X    send email to the following address:
  206. X
  207. X    Arthur W. Neilson III
  208. X    INET: art@pilikia.pegasus.com
  209. X    UUCP: uunet!ucsd!nosc!pilikia!art
  210. X
  211. END_OF_FILE
  212. if test 3910 -ne `wc -c <'README'`; then
  213.     echo shar: \"'README'\" unpacked with wrong size!
  214. fi
  215. # end of 'README'
  216. fi
  217. if test -f 'common.h' -a "${1}" != "-c" ; then 
  218.   echo shar: Will not clobber existing file \"'common.h'\"
  219. else
  220. echo shar: Extracting \"'common.h'\" \(1885 characters\)
  221. sed "s/^X//" >'common.h' <<'END_OF_FILE'
  222. X/*
  223. X**    c o m m o n . h
  224. X**
  225. X**    common header file for UPS monitor daemon
  226. X**
  227. X**    Arthur W. Neilson III
  228. X**    art@pilikia.pegasus.com
  229. X**    Sat Mar 30 1991
  230. X*/
  231. X
  232. X#include <stdio.h>
  233. X#include <string.h>
  234. X#include <fcntl.h>
  235. X#include <time.h>
  236. X#include <sys/types.h>
  237. X#include <sys/termio.h>
  238. X#include <sys/signal.h>
  239. X#include <sys/stat.h>
  240. X
  241. X#define ERR        -1        /* error return value */
  242. X#define SH        "/bin/sh"    /* shell to exec shutdown command */
  243. X#define ROOT        "/"        /* root directory for chdir */
  244. X#define CONSOLE        "/dev/console"    /* console device */
  245. X#define SECS_PER_MIN    60        /* number of secs in a minute */
  246. X#define MAX_TIME    30        /* maximum delay time allowed */
  247. X#define SHUT_PERMS    0500        /* shutdown command permissions mask */
  248. X#define LOG_PERMS    0600        /* logfile permissions on create */
  249. X#define LOG_FLAGS    O_WRONLY | O_CREAT | O_APPEND    /* logfile open flags */
  250. X
  251. X/* default tuneable parameter values */
  252. X#define UPS_PORT    "/dev/ttyFM00"    /* UPS port device name */
  253. X#define UPS_SHUT    "/etc/shutdown -y -g0"    /* shutdown command */
  254. X#define UPS_LOG        "/etc/upslog"    /* UPS log file pathname */
  255. X#define UPS_TIME    10        /* default delay time (minutes) */
  256. X
  257. X/* environment variable names */
  258. X#define UPSPORT        "UPSPORT"
  259. X#define UPSSHUT        "UPSSHUT"
  260. X#define UPSLOG        "UPSLOG"
  261. X#define UPSTIME        "UPSTIME"
  262. X
  263. X/* UPS log messages */
  264. X#define START_MSG    "UPS daemon started"
  265. X#define OPEN_MSG    "Error opening UPS port"
  266. X#define BATTERY_MSG    "UPS switch to battery backup"
  267. X#define ONLINE_MSG    "UPS switch to online power"
  268. X#define SHUTDOWN_MSG    "Shutdown command executed"
  269. X#define TERM_MSG    "Caught termination signal"
  270. X
  271. X/* common globals */
  272. Xextern char   *ups_port;        /* UPS device name */
  273. Xextern char   *ups_shut;        /* system shutdown command */
  274. Xextern char   *ups_log;            /* UPS log file name */
  275. Xextern int     ups_time;        /* delay time before shutdown */
  276. Xextern int     ups_fd;            /* UPS port descriptor */
  277. Xextern int     log_fd;            /* log file descriptor */
  278. END_OF_FILE
  279. if test 1885 -ne `wc -c <'common.h'`; then
  280.     echo shar: \"'common.h'\" unpacked with wrong size!
  281. fi
  282. # end of 'common.h'
  283. fi
  284. if test -f 'funcs.c' -a "${1}" != "-c" ; then 
  285.   echo shar: Will not clobber existing file \"'funcs.c'\"
  286. else
  287. echo shar: Extracting \"'funcs.c'\" \(4629 characters\)
  288. sed "s/^X//" >'funcs.c' <<'END_OF_FILE'
  289. X/*
  290. X**    f u n c s . c
  291. X**
  292. X**    functions for UPS monitor daemon
  293. X**
  294. X**    Arthur W. Neilson III
  295. X**    art@pilikia.pegasus.com
  296. X**    Sat Mar 30 1991
  297. X*/
  298. X
  299. X#include "common.h"
  300. X
  301. X/*
  302. X**    g e t v a r s
  303. X**
  304. X**    retrieve environment variables
  305. X*/
  306. Xvoid
  307. Xgetvars()
  308. X{
  309. X    char   *s, *getenv();
  310. X
  311. X    if ((s = getenv(UPSPORT)) != NULL)
  312. X        ups_port = s;
  313. X    if ((s = getenv(UPSSHUT)) != NULL)
  314. X        ups_shut = s;
  315. X    if ((s = getenv(UPSLOG)) != NULL)
  316. X        ups_log = s;
  317. X    if ((s = getenv(UPSTIME)) != NULL)
  318. X        ups_time = atoi(s) * SECS_PER_MIN;
  319. X}
  320. X
  321. X/*
  322. X**    g e t o p t i o n s
  323. X**
  324. X**    retrieve and process command line options
  325. X*/
  326. Xvoid
  327. Xgetoptions(ac, av)
  328. Xint     ac;
  329. Xchar   *av[];
  330. X{
  331. X    int     c;
  332. X
  333. X    void    usage();
  334. X
  335. X    extern char *optarg;
  336. X    extern int optind, opterr;
  337. X
  338. X    /* parse the command line */
  339. X    while ((c = getopt(ac, av, "d:c:l:t:")) != EOF)
  340. X        switch (c) {
  341. X        case 'd':    /* device option */
  342. X            ups_port = optarg;
  343. X            break;
  344. X        case 'c':    /* command option */
  345. X            ups_shut = optarg;
  346. X            break;
  347. X        case 'l':    /* logfile option */
  348. X            ups_log = optarg;
  349. X            break;
  350. X        case 't':    /* time option */
  351. X            ups_time = atoi(optarg) * SECS_PER_MIN;
  352. X            break;
  353. X        case '\?':    /* illegal option */
  354. X            usage(av[0]);
  355. X            exit(1);
  356. X        }
  357. X}
  358. X
  359. X/*
  360. X**    c h k o p t i o n s
  361. X**
  362. X**    check runtime options
  363. X*/
  364. Xvoid
  365. Xchkoptions()
  366. X{
  367. X    struct stat st;
  368. X    char   *p, buf[64];
  369. X
  370. X    /* UPS port must exist */
  371. X    if (stat(ups_port, &st) == ERR) {
  372. X        perror(ups_port);
  373. X        exit(1);
  374. X    }
  375. X    /* and must be character special */
  376. X    if ((st.st_mode & S_IFMT) != S_IFCHR) {
  377. X        fprintf(stderr, "%s not character special\n", ups_port);
  378. X        exit(1);
  379. X    }
  380. X    /* get command name out of shutdown command */
  381. X    strcpy(buf, ups_shut);
  382. X    if ((p = strtok(buf, " ")) == NULL)
  383. X        p = buf;
  384. X
  385. X    /* shutdown command must exist */
  386. X    if (stat(p, &st) == ERR) {
  387. X        perror(ups_shut);
  388. X        exit(1);
  389. X    }
  390. X    /* and must be readable/executable by owner */
  391. X    if (!(st.st_mode & SHUT_PERMS)) {
  392. X        fprintf(stderr, "%s must be readable/executable by owner\n", ups_port);
  393. X        exit(1);
  394. X    }
  395. X    /* delay time must be > 0 and <= MAX_TIME */
  396. X    if (ups_time < 1 || ups_time > MAX_TIME) {
  397. X        fprintf(stderr, "time must be between 1 and %d\n", MAX_TIME);
  398. X        exit(1);
  399. X    }
  400. X}
  401. X
  402. X/*
  403. X**    m k d a e m o n
  404. X**
  405. X**    create daemon process
  406. X*/
  407. Xvoid
  408. Xmkdaemon()
  409. X{
  410. X    char    c;
  411. X
  412. X    void    sigcatch();
  413. X    void    writelog();
  414. X    void    shutdown();
  415. X
  416. X    if (!fork()) {
  417. X
  418. X        /* close standard files */
  419. X        close(0);    /* stdin */
  420. X        close(1);    /* stdout */
  421. X        close(2);    /* stderr */
  422. X
  423. X        setpgrp();    /* disassociate from terminal */
  424. X
  425. X        /* ignore interrupts */
  426. X        signal(SIGHUP, SIG_IGN);
  427. X        signal(SIGINT, SIG_IGN);
  428. X        signal(SIGQUIT, SIG_IGN);
  429. X
  430. X        /* catch termination signal */
  431. X        signal(SIGTERM, sigcatch);
  432. X
  433. X        /* and shutdown on alarm */
  434. X        signal(SIGALRM, shutdown);
  435. X
  436. X        /* open log file for append */
  437. X        if ((log_fd = open(ups_log, LOG_FLAGS, LOG_PERMS)) == ERR)
  438. X            exit(1);
  439. X
  440. X        writelog(START_MSG);
  441. X
  442. X        /* open blocks on UPS switch to battery */
  443. X        if ((ups_fd = open(ups_port, O_RDWR)) == ERR) {
  444. X            writelog(OPEN_MSG);
  445. X            exit(1);
  446. X        }
  447. X        writelog(BATTERY_MSG);
  448. X
  449. X        alarm(ups_time);/* set the alarm clock */
  450. X
  451. X        /* read blocks on UPS switch to online */
  452. X        if (read(ups_fd, &c, 1) == ERR)
  453. X            exit(1);
  454. X
  455. X        writelog(ONLINE_MSG);
  456. X
  457. X        close(log_fd);
  458. X        close(ups_fd);
  459. X
  460. X        mkdaemon();
  461. X    }
  462. X}
  463. X
  464. X/*
  465. X**    s i g c a t c h
  466. X**
  467. X**    catch termination signal
  468. X*/
  469. Xvoid
  470. Xsigcatch()
  471. X{
  472. X    writelog(TERM_MSG);
  473. X    close(log_fd);
  474. X    close(ups_fd);
  475. X    exit(1);
  476. X}
  477. X
  478. X/*
  479. X**    w r i t e l o g
  480. X**
  481. X**    write message to the UPS log file
  482. X*/
  483. Xvoid
  484. Xwritelog(msg)
  485. Xchar   *msg;
  486. X{
  487. X    time_t  ticks;
  488. X    char   *p, *ct;
  489. X    char    msg_buf[80];
  490. X
  491. X    time(&ticks);
  492. X    ct = ctime(&ticks);
  493. X
  494. X    /* find newline in buffer */
  495. X    if ((p = strrchr(ct, '\n')) != NULL)
  496. X        *p = NULL;    /* and zap it */
  497. X
  498. X    sprintf(msg_buf, "%s -- %s\n", ct, msg);
  499. X    write(log_fd, msg_buf, strlen(msg_buf));
  500. X}
  501. X
  502. X/*
  503. X**    s h u t d o w n
  504. X**
  505. X**    shutdown the system
  506. X*/
  507. Xvoid
  508. Xshutdown()
  509. X{
  510. X    void    attach();
  511. X
  512. X    writelog(SHUTDOWN_MSG);
  513. X
  514. X    close(log_fd);
  515. X    close(ups_fd);
  516. X
  517. X    attach(CONSOLE);
  518. X
  519. X    chdir(ROOT);
  520. X
  521. X    /* execute shutdown command */
  522. X    execlp(SH, SH, "-c", ups_shut, NULL);
  523. X}
  524. X
  525. X/*
  526. X**    a t t a c h
  527. X**
  528. X**    attach standard i/o to a device
  529. X*/
  530. Xvoid
  531. Xattach(dev)
  532. Xchar   *dev;
  533. X{
  534. X    int     fd;
  535. X
  536. X    /* close standard files */
  537. X    close(0);        /* stdin */
  538. X    close(1);        /* stdout */
  539. X    close(2);        /* stderr */
  540. X
  541. X    /* attach stdin to named device */
  542. X    if ((fd = open(dev, O_RDWR)) == ERR)
  543. X        exit(1);
  544. X    dup(fd);        /* and stdout */
  545. X    dup(fd);        /* and stderr */
  546. X}
  547. X
  548. X/*
  549. X**    u s a g e
  550. X**
  551. X**    display program usage
  552. X*/
  553. Xvoid
  554. Xusage(s)
  555. Xchar   *s;
  556. X{
  557. X    fprintf(stderr, "usage: %s [-d tty][-c cmd][-l log][-t min]\n", s);
  558. X    fprintf(stderr, "\t-d tty\t\tpathname of UPS device\n");
  559. X    fprintf(stderr, "\t-c cmd\t\tpathname of shutdown command\n");
  560. X    fprintf(stderr, "\t-l log\t\tpathname of UPS log file\n");
  561. X    fprintf(stderr, "\t-t min\t\tdelay time in minutes\n");
  562. X}
  563. END_OF_FILE
  564. if test 4629 -ne `wc -c <'funcs.c'`; then
  565.     echo shar: \"'funcs.c'\" unpacked with wrong size!
  566. fi
  567. # end of 'funcs.c'
  568. fi
  569. if test -f 'main.c' -a "${1}" != "-c" ; then 
  570.   echo shar: Will not clobber existing file \"'main.c'\"
  571. else
  572. echo shar: Extracting \"'main.c'\" \(692 characters\)
  573. sed "s/^X//" >'main.c' <<'END_OF_FILE'
  574. X/*
  575. X**    m a i n . c
  576. X**
  577. X**    main program for UPS monitor daemon
  578. X**
  579. X**    Arthur W. Neilson III
  580. X**    art@pilikia.pegasus.com
  581. X**    Sat Mar 30 1991
  582. X*/
  583. X
  584. X#include "common.h"
  585. X
  586. X/* default tuneables */
  587. Xchar   *ups_port = UPS_PORT;
  588. Xchar   *ups_shut = UPS_SHUT;
  589. Xchar   *ups_log = UPS_LOG;
  590. Xint     ups_time = UPS_TIME;
  591. X
  592. X/* global descriptors */
  593. Xint     ups_fd;
  594. Xint     log_fd;
  595. X
  596. Xmain(argc, argv)
  597. Xint     argc;
  598. Xchar   *argv[];
  599. X{
  600. X    void    getvars();
  601. X    void    getoptions();
  602. X    void    chkoptions();
  603. X    void    mkdaemon();
  604. X
  605. X    getvars();        /* retrieve environment vars */
  606. X    getoptions(argc, argv);    /* process command line options */
  607. X    chkoptions();        /* validate command line options */
  608. X    mkdaemon();        /* fork daemon process */
  609. X}
  610. END_OF_FILE
  611. if test 692 -ne `wc -c <'main.c'`; then
  612.     echo shar: \"'main.c'\" unpacked with wrong size!
  613. fi
  614. # end of 'main.c'
  615. fi
  616. if test -f 'ups' -a "${1}" != "-c" ; then 
  617.   echo shar: Will not clobber existing file \"'ups'\"
  618. else
  619. echo shar: Extracting \"'ups'\" \(296 characters\)
  620. sed "s/^X//" >'ups' <<'END_OF_FILE'
  621. X#ident    "@(#)ups    1.0 - 91/03/30"
  622. X#    UPS monitor daemon
  623. X
  624. X# configure UPS daemon runtime
  625. Xexport UPSPORT; UPSPORT=/dev/ttyFM00
  626. Xexport UPSSHUT; UPSSHUT="/etc/shutdown -y -i0"
  627. Xexport UPSLOG;  UPSLOG=/etc/upslog
  628. Xexport UPSTIME; UPSTIME=10
  629. X
  630. Xset `who -r`
  631. Xif [ $9 = "S" -a -x /etc/upsd ]
  632. Xthen
  633. X    /etc/upsd
  634. Xfi
  635. END_OF_FILE
  636. if test 296 -ne `wc -c <'ups'`; then
  637.     echo shar: \"'ups'\" unpacked with wrong size!
  638. fi
  639. chmod +x 'ups'
  640. # end of 'ups'
  641. fi
  642. echo shar: End of archive 1 \(of 1\).
  643. cp /dev/null ark1isdone
  644. MISSING=""
  645. for I in 1 ; do
  646.     if test ! -f ark${I}isdone ; then
  647.     MISSING="${MISSING} ${I}"
  648.     fi
  649. done
  650. if test "${MISSING}" = "" ; then
  651.     echo You have the archive.
  652.     rm -f ark[1-9]isdone
  653. else
  654.     echo You still need to unpack the following archives:
  655.     echo "        " ${MISSING}
  656. fi
  657. ##  End of shell archive.
  658. exit 0
  659. -----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
  660.  
  661. -- 
  662. Arthur W. Neilson III        | INET: art@pilikia.pegasus.com
  663. Bank of Hawaii Tech Support    | UUCP: uunet!ucsd!nosc!pilikia!art
  664.  
  665. exit 0 # Just in case...
  666. -- 
  667. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  668. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  669. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  670. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  671.